package com.google.denta.service;

import java.util.List;


import com.google.denta.entity.PaginatorForm;
import com.google.denta.entity.User;

/**
 * User service.
 * @author Kiril_Akshonau
 */
public interface UserService {

    /**
     * Get all users.
     * @return list of users.
     */
    List<User> getUsers();

    /**
     * Get user by id.
     * @param id
     *            of user
     * @return user with id
     */
    User getUser(Long id);

    /**
     * Get user by login.
     * @param name
     *            - login of user
     * @return User
     */
    User getUserByName(String name);

    /**
     * Create or update user.
     * @param user
     *            - user for save
     */
    void saveUser(User user);

    /**
     * Delete user.
     * @param id
     *            - id of user for delete
     */
    void deleteUser(Long id);

    /**
     * Delete users.
     * @param ids
     *            - ids of users for delete
     */
    void deleteUsers(Long[] ids);

    /**
     * Save roles of user.
     * @param user
     *            to save roles
     */
    void saveUserRoles(User user);

    /**
     * Save groups of user.
     * @param user
     *            to save groups
     */
    void saveUserGroups(User user);

    /**
     * Find user by password.
     * @param id
     *            - user id to search
     * @param password
     *            - password to search
     * @return user
     */
    User getByPassword(Long id, String password);

    /**
     * Update user.
     * @param user
     *            - user to update.
     */
    void update(User user);

    /**
     * Find by form.
     * @param form
     *            - user form.
     * @return list of user.
     */
    List<User> paginatorFind(PaginatorForm form);

    /**
     * Users count.
     * @return user count.
     */
    Long getUsersCount();

    /**
     * @param user - user to update password
     */
    void updatePassword(User user);

    /**
     * @param id - persone id
     * @return user, that associate with specified persone,
     * or null, if no one from users associate with specified persone
     */
    User getByPersone(Long id);
}
